/*     */ package nc.bs.ic.m45.update;
/*     */ 
/*     */ import java.io.Serializable;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import nc.bs.ic.general.rule.before.CtplcustomeridCheck;
/*     */ import nc.bs.ic.general.update.IUpdateBP;
/*     */ import nc.bs.ic.general.update.UpdateBPTemplate;
/*     */ import nc.bs.ic.m45.base.BPPlugInPoint;
/*     */ import nc.bs.ic.m45.base.rule.FillCostOrgRule;
/*     */ import nc.bs.ic.m45.base.rule.PurchaseBillCheckRule;
/*     */ import nc.bs.ic.m45.base.rule.PurchaseInAssetWarehouseCheck;
/*     */ import nc.bs.ic.m45.base.rule.PurchaseInVOScaleCheckRule;
/*     */ import nc.bs.ic.m45.base.rule.PurchaseinRetMarginProcess;
/*     */ import nc.bs.ic.m45.base.rule.PurchaseinRetMarginProcessFor5805;
/*     */ import nc.bs.ic.m45.base.rule.ReturnSnIsExistInEquipcardCheck;
/*     */ import nc.bs.ic.m45.base.rule.VmiCheckRule;
/*     */ import nc.bs.ic.m45.insert.rule.InsertCheckMaterialUnit;
/*     */ import nc.bs.ic.m45.update.rule.IsRedBookThroughUpdate;
/*     */ import nc.bs.ic.m45.update.rule.UpdReWritePIM;
/*     */ import nc.bs.ic.m45.update.rule.UpdateNumCheck;
/*     */ import nc.bs.ic.m45.update.rule.UpdateRewriteITRule;
/*     */ import nc.bs.ic.m45.update.rule.UpdateRewritePORule;
/*     */ import nc.bs.ic.pub.base.ICCompareAroundProcesser;
/*     */ import nc.bs.ic.pub.base.IUpdateRuleProvider;
/*     */ import nc.bs.ic.pub.util.SagasUtils;
/*     */ import nc.bs.scmpub.rule.VOSagaFrozenValidateRule;
/*     */ import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
/*     */ import nc.vo.ic.general.define.ICBillVO;
/*     */ import nc.vo.ic.m45.entity.PurchaseInBodyVO;
/*     */ import nc.vo.ic.m45.entity.PurchaseInVO;
/*     */ import nc.vo.ic.pub.util.StringUtil;
/*     */ import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
/*     */ import nc.vo.scmpub.res.billtype.ICBillType;
/*     */ import nccloud.bs.ic.mobile.inbound.operation.rewrite.MobAfterPurchaseInUpdate;
/*     */ import nccloud.bs.ic.mobile.inbound.operation.rewrite.MobBeforePurchaseInUpdate;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class UpdateBP
/*     */   extends Object
/*     */   implements IUpdateBP<PurchaseInVO>, IUpdateRuleProvider<PurchaseInVO>
/*     */ {
/*     */   public void addAfterRule(PurchaseInVO[] vos, PurchaseInVO[] originVOs, CompareAroundProcesser<PurchaseInVO> processor) {
/*  52 */     processor.addAfterRule(new IsRedBookThroughUpdate());
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     
/*  58 */     ((ICCompareAroundProcesser)processor).addAfterRuleAt(new UpdateRewritePORule(), nc.bs.ic.general.rule.after.AtpAfterUpdate.class);
/*     */     
/*  60 */     processor.addAfterRule(new UpdReWritePIM());
/*     */     
/*  62 */     processor.addAfterRule(new UpdateRewriteITRule());
/*     */     
/*  64 */     processor.addAfterRule(new MobAfterPurchaseInUpdate());
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void addBeforeRule(PurchaseInVO[] vos, PurchaseInVO[] originVOs, CompareAroundProcesser<PurchaseInVO> processor) {
/*  71 */     processor.addBeforeRule(new VOSagaFrozenValidateRule(true));
/*  72 */     processor.addBeforeRule(new FillCostOrgRule());
/*  73 */     processor.addBeforeRule(new PurchaseBillCheckRule());
/*  74 */     processor.addBeforeRule(new PurchaseInAssetWarehouseCheck());
/*  75 */     processor.addBeforeRule(new CtplcustomeridCheck());
/*  76 */     processor.addBeforeRule(new VmiCheckRule());
/*  77 */     processor.addBeforeRule(new ReturnSnIsExistInEquipcardCheck());
/*  78 */     processor.addBeforeRule(new PurchaseinRetMarginProcess());
/*  79 */     processor.addBeforeRule(new PurchaseinRetMarginProcessFor5805());
/*  80 */     processor.addBeforeRule(new PurchaseInVOScaleCheckRule());
/*     */ 
/*     */ 
/*     */     
/*  84 */     processor.addBeforeRule(new InsertCheckMaterialUnit());
/*  85 */     processor.addBeforeRule(new MobBeforePurchaseInUpdate());
/*     */     
/*  87 */     processor.addBeforeRule(new UpdateNumCheck());
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public PurchaseInVO[] update(PurchaseInVO[] vos, PurchaseInVO[] originVOs) {
/*  98 */     SagasUtils.frozenAndAddSaga(vos, ICBillType.PurchaseIn.getCode(), "1", null);
/*  99 */     Map<String, Serializable> paramMap = new HashMap<String, Serializable>();
/* 100 */     paramMap.put("actionname", "update_45");
/* 101 */     paramMap.put("vos", SagasUtils.produceLightVO(vos, originVOs));
/* 102 */     SagasUtils.compensate(paramMap, nc.itf.ic.m45.compensate.IPurchaseInSagasCompensate.class);
/* 103 */     fillCvendorid(vos);
/* 104 */     UpdateBPTemplate<PurchaseInVO> updateBP = new UpdateBPTemplate<PurchaseInVO>(BPPlugInPoint.UpdateBP, this);
/* 105 */     return (PurchaseInVO[])updateBP.update(vos, originVOs);
/*     */   }
/*     */ 
/*     */   
/*     */   private void fillCvendorid(PurchaseInVO[] vos) {
/* 110 */     String cvendor = null;
/* 111 */     String cvendorvid = null;
/* 112 */     for (PurchaseInVO vo : vos) {
/*     */       
/* 114 */       cvendor = vo.getHead().getCvendorid();
/*     */       
/* 116 */       cvendorvid = vo.getHead().getCvendorvid();
/*     */ 
/*     */       
/* 119 */       for (PurchaseInBodyVO body : vo.getBodys()) {
/* 120 */         if (!StringUtil.isStringEqual(cvendor, body.getCvendorid())) {
/*     */ 
/*     */           
/* 123 */           body.setCvendorid(cvendor);
/* 124 */           body.setCvendorvid(cvendorvid);
/* 125 */           if (0 == body.getStatus())
/*     */           {
/* 127 */             body.setStatus(1);
/*     */           }
/*     */         } 
/*     */       } 
/*     */     } 
/*     */   }
/*     */ }


/* Location:              E:\zhuhai_ncc\NCC2111\modules\ic\META-INF\lib\ic_inbound.jar!/nc/bs/ic/m45/update/UpdateBP.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */